package com.isoft.demo.dao;

import com.isoft.demo.entity.Maintenance;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface MaintenanceDao {
    //新增
    @Insert("insert into maintenance(maintain,repair,eidm,mtime,mstatus,maddress,mcost) values(#{maintain},#{repair},#{eidm},#{mtime},#{mstatus},#{maddress},#{mcost})")
    int addMain(Maintenance maintenance);
    //修改
    @Update("update maintenance set maintain=#{maintain},repair=#{repair},eidm=#{eidm},mtime=#{mtime},mstatus=#{mstatus},maddress=#{maddress},mcost=#{mcost}")
    int updateMain(Maintenance maintenance);
    //查询所有
    @Select("select * from maintenance")
    List<Maintenance> findAllMain();
    //根据id查询
    @Select("select mid from maintenance")
    List<Maintenance> findByMid(Integer mid);
}
